#ifndef X_DND_H
#define X_DND_H

#include <X11/Xlib.h>
#include <X11/X.h>
#include <X11/Xatom.h>
#include <vector>
#include <string>

class Dnd
{
public:
    Dnd();
    ~Dnd();

    void initialize(Display* display, Window window);
    void handleEnterEvent(const XEvent& xEvent);
    bool handleLeaveEvent(const XEvent& xEvent);
    bool handleDropEvent();
    void handlePositionEvent(const XEvent& xEvent);

    std::string getDroppedFilenames(const XEvent& xEvent);


public:
    Atom XdndEnter;
    Atom XdndLeave;
    Atom XdndDrop;
    Atom XdndPosition;
    Atom XdndActionPrivate;

private:
    void setDndAware();
    void unsetDndAware();
    void sendFinished();
    bool generateTypeList(Window window, std::vector<Atom>& typeList);

private:
    Time        m_Time;
    int         m_DropPosX;
    int         m_DropPosY;
    Window      m_Window;
    Window      m_DragWindow;

    Display*    m_pDisplay;
    Atom        m_Version;
    Atom        m_DesiredType;
};

#endif
